#ifndef _XBASE_ERROR_HEADER
#define _XBASE_ERROR_HEADER

#include <string>
#include <map>
#include "constants.h"
#include "XBaseClient.h"

enum {
    XERROR_CANCEL = -2,
	XERROR_FAIL = -1,
    XERROR_SUCC = XBaseClient::PERR_SUCCESS,
	XERROR_SERVER_CONNECT = XBaseClient::PERR_NUMBER+1,
	XERROR_SERVER_SEND,
	XERROR_SERVER_RECV,
	XERROR_ROOT_NOT_EXIST,
	XERROR_TABLET_NOT_EXIST,
	XERROR_BUFFER_ENCODE_OVERFLOW,
	XERROR_BUFFER_DECODE_UNDERFLOW,
	XERROR_MAX = XERROR_BUFFER_DECODE_UNDERFLOW
};
const char * const protocolErrorMessageExt[XERROR_MAX - XBaseClient::PERR_NUMBER] = {
	"connect to server fail",
	"send to server fail",
	"recv from server fail",
	"root tablet not exists",
	"tablet not exists",
	"encode buffer too small",     //5
	"decode buffer too small"
};
const char* xerror(int err);

#if defined(M_XERROR)
std::map<int, std::string> g_xerror_list;
#endif

#endif // _XBASE_ERROR_HEADER

